/*	kd:
	
	All the button sprites (pending update).
	
	*/

struct Gcs_ButtonSprites {
	// UPDATE UPDATE UPDATE
	// UPDATE UPDATE UPDATE
	const lamp_count	= 8;
	const darken_alpha	= 0.5;
	const equip_alpha	= 0.75;
	
	const m_worse       = "lmao6";
	const m_shiny       = "lmao3";
	const m_normal      = "lmao2";
	const m_highlight   = "lmao4";
	const m_new			= "lmao1";
	const m_no_lamps    = "lmao0";
	const m_equip_ring  = "lol5";
	const m_darken      = "contain";
	
	/*	TODO: These don't belong here anymore. */
	const m_arrow_left  = "loll";
	const m_arrow_right = "lolr";
	const m_msg_box     = "widebar2";
	
	const m_lamp_count		= 8;
	const total_states		= m_lamp_count + 1;
	const darken_amount		= 0.5;
	const equip_ring_alpha	= 0.75;
	const equip_ring_tint	= 0xFF50C5E0;
	
	TextureId sprite_worse     [total_states];
	TextureId sprite_shiny     [total_states];
	TextureId sprite_new       [total_states];
	TextureId sprite_normal    [total_states];
	TextureId sprite_highlight [total_states];
	TextureId sprite_no_lamps;
	TextureId sprite_equip_ring;
	TextureId sprite_darken;
	
	void Cache () {
		
		for(uint i = 1; i < total_states; i++) {
			uint lamps = i;
			
			sprite_worse [i] = TexMan.CheckForTexture(
				String.Format("%s%i", m_worse, lamps), TexMan.TYPE_ANY);
			sprite_shiny [i] = TexMan.CheckForTexture(
				String.Format("%s%i", m_shiny, lamps), TexMan.TYPE_ANY);
			sprite_normal [i] = TexMan.CheckForTexture(
				String.Format("%s%i", m_normal, lamps), TexMan.TYPE_ANY);
			sprite_highlight [i] = TexMan.CheckForTexture(
				String.Format("%s%i", m_highlight, lamps), TexMan.TYPE_ANY);
			sprite_new [i] = TexMan.CheckForTexture(
				String.Format("%s%i", m_new, lamps), TexMan.TYPE_ANY);
		}
		
		sprite_no_lamps = TexMan.CheckForTexture(m_no_lamps, TexMan.TYPE_ANY);
		sprite_equip_ring = TexMan.CheckForTexture(m_equip_ring, TexMan.TYPE_ANY);
		sprite_darken = TexMan.CheckForTexture(m_darken, TexMan.TYPE_ANY);
		
		sprite_worse     [0] = sprite_worse     [total_states - 1];
		sprite_shiny     [0] = sprite_no_lamps;
		sprite_normal    [0] = sprite_no_lamps;
		sprite_highlight [0] = sprite_highlight [total_states - 1];
		sprite_new       [0] = sprite_no_lamps;
		// sprite_new       [0] = sprite_new       [total_states - 1];
	}
	
	
	TextureId Darken       () { return sprite_darken; }
	TextureId EquipOverlay () { return sprite_equip_ring; }
	
	TextureId Worse     (uint lamps = 0) { return sprite_worse     [min(lamps, total_states - 1)]; }
	TextureId Shiny     (uint lamps = 0) { return sprite_shiny     [min(lamps, total_states - 1)]; }
	TextureId Normal    (uint lamps = 0) { return sprite_normal    [min(lamps, total_states - 1)]; }
	TextureId Highlight (uint lamps = 0) { return sprite_highlight [min(lamps, total_states - 1)]; }
	TextureId Gold      (uint lamps = 0) { return sprite_new       [min(lamps, total_states - 1)]; }
	
	TextureId Suitable (
	uint lamp_count		= 0,
	bool is_marked		= false,
	bool is_worse		= false,
	bool is_new			= false) const {
		if(is_new) {
			return Gold(lamp_count);
		}
		
		else if(is_worse) {
			return Worse(lamp_count);
		}
		
		else if(is_marked) {
			return Shiny(lamp_count);
		}
		
		return Normal(lamp_count);
	}
}